
import { IncomingHttpHeaders } from 'http';

import query from '@dfeidao/atom-nodejs/db/query';

import { productid, systemid } from '../../atom/config';

interface Message {
	filter: {
		question_no: string
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}


export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const pre = query(action_id, session_id, systemid);
	pre.prepare('question_bank', ['question_no', 'topic', 'topic_type', 'right_answer', 'question_bank_type', 'option_a', 'option_b', 'option_c', 'option_d'],
		{ productid, question_no: message.filter.question_no }, 1, 1, [], []);

	const [dt] = await pre.exec();
	return { dt };

}
